package cn.yangliu.springbatch.entity;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * the type of springbatch
 *
 * <p>
 * .
 *
 * @author 杨柳
 * @date 2021-07-12
 */
@Entity
@Table(name = "t_role")
@EntityListeners(AuditingEntityListener.class)
public class Role implements Serializable {


    private static final long serialVersionUID = 6198826377586064084L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private String rolename;

    public Role() {
    }

    public Role(String rolename) {
        this.rolename = rolename;
    }

    @CreatedDate
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @LastModifiedDate
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;

    /**
     * instance member witch named id‘s getter
     * <p>
     * for get field witch named id’s value
     *
     * @return id
     */
    public Long getId() {
        return id;
    }

    /**
     * instance member witch named id's setter
     * for set field witch named id's value
     *
     * @param id id
     */
    public Role setId(Long id) {
        this.id = id;
        return this;
    }

    /**
     * instance member witch named rolename‘s getter
     * <p>
     * for get field witch named rolename’s value
     *
     * @return rolename
     */
    public String getRolename() {
        return rolename;
    }

    /**
     * instance member witch named rolename's setter
     * for set field witch named rolename's value
     *
     * @param rolename rolename
     */
    public Role setRolename(String rolename) {
        this.rolename = rolename;
        return this;
    }

    /**
     * instance member witch named createTime‘s getter
     * <p>
     * for get field witch named createTime’s value
     *
     * @return createTime
     */
    public LocalDateTime getCreateTime() {
        return createTime;
    }

    /**
     * instance member witch named createTime's setter
     * for set field witch named createTime's value
     *
     * @param createTime createTime
     */
    public Role setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
        return this;
    }

    /**
     * instance member witch named updateTime‘s getter
     * <p>
     * for get field witch named updateTime’s value
     *
     * @return updateTime
     */
    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    /**
     * instance member witch named updateTime's setter
     * for set field witch named updateTime's value
     *
     * @param updateTime updateTime
     */
    public Role setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
        return this;
    }
}
